#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMenu>
#include <QMenuBar>
#include <QLabel>
#include <QRandomGenerator>
#include <QApplication>
#include "../src/docking_pane_manager.h"
#include "../src/docking_workbench.h"
#include <QDebug>
#include <QLabel>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    m_dockingPaneManager = new fmqt::DockingPaneManager(this);
    this->setCentralWidget(m_dockingPaneManager->widget());
    QString group="label";
    for(int i=0;i<6;i++){
        QLabel* label = new QLabel(QString("LABEL:%1").arg(i),(QWidget* )m_dockingPaneManager->workbench());
        //label->setMinimumSize(QSize(400,400));
        QString id = QString("id:%1").arg(i);
        m_dockingPaneManager->createPane(id,group,QString("title:%1").arg(i),label,i==0? fmqt::DockingPaneManager::Center:fmqt::DockingPaneManager::Left);
    }
    QLabel* label = new QLabel(QString("Fixed Window"),(QWidget* )m_dockingPaneManager->workbench());
    m_dockingPaneManager->createFixedPane("11","fix","Fixed Window",label, fmqt::DockingPaneManager::S_Left);
    //connect(m_dockingPaneManager->workbench(),&fmqt::DockingWorkbench::onShow,this,&FMDockWindow::onShow);
}

void MainWindow::onShow(){
    QLabel* label2 = new QLabel(QString("Float Window"),(QWidget* )m_dockingPaneManager->workbench());
    m_dockingPaneManager->createFloatPane("22","float","Float Window",label2);
}

MainWindow::~MainWindow()
{
    delete ui;
}
